package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.AbstractBorder;

public class BorderedLabel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JLabel label;

	public BorderedLabel(String text, Color color, int fontSize) {
		super(new GridLayout(1, 1), false);
		// this.setBackground(new Color(0xC0C0C0));
		this.setBackground(Color.BLACK);
		Font myFont = new Font("Verdana", Font.ITALIC | Font.BOLD, fontSize);
		this.setPreferredSize(new Dimension(450, 100));
		this.setMinimumSize(new Dimension(450, 100));

		System.out.println(text + " " + this.getSize().width);
		TextBubbleBorder border = new TextBubbleBorder(Color.GRAY, 3, 16, 16);
		this.add(label = new JLabel(text, JLabel.CENTER));
		label.setFont(myFont);
		label.setForeground(color);
		this.setBorder(border);
		// border.addChild();
	}

	public BorderedLabel(String text, Color color, int fontSize, int alignment,
			int width, int height) {
		super(new GridLayout(1, 1), false);
		this.setBackground(new Color(0xC0C0C0));
		Font myFont = new Font("Verdana", Font.PLAIN, fontSize);
		this.setPreferredSize(new Dimension(width, height));
		this.setMinimumSize(new Dimension(width, height));

		System.out.println(text + " " + this.getSize().width);
		AbstractBorder border = new TextBubbleBorder(new Color(0x8b8989), 3,
				16, 16);
		this.add(label = new JLabel(text, alignment));
		label.setFont(myFont);
		label.setForeground(color);
		this.setBorder(border);
	}
	
	public void setText(String text){
		label.setText(text);
	}

	public void setTextForeground(Color color) {
		label.setForeground(color);
	}

}
